﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TackMessenger;

namespace TackMessenger
{
    public partial class NameGetter : Form
    {
        public NameGetter()
        {
            InitializeComponent();
            nameSetter.Text = Props.getUsername();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (nameSetter.Text != "")
            {
                Props.setUsername(nameSetter.Text);
                this.Hide();
            }
        }


     

        private void nameSetter_TextChanged(object sender, EventArgs e)
        {
            this.KeyDown += new KeyEventHandler(Form1_KeyDown);


        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {

            if (e.KeyCode == Keys.Enter)
            {
                if (nameSetter.Text != "")
                {
                    Props.setUsername(nameSetter.Text);
                    this.Hide();
                }
            }


        }

    }

}
